package com.hp.controller;

import com.github.pagehelper.PageInfo;
import com.hp.entity.LoginInfor;
import com.hp.service.LoginInforService;
import com.hp.util.ResultJson;
import com.hp.util.Utils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping("logininfor")
public class LoginInforController {

    @Autowired
    LoginInforService loginInforService;
//查询登陆日志
    @RequestMapping("selectAll")
    public void select(HttpServletRequest request, HttpServletResponse response, @Param("limit") Integer limit, @Param("page") Integer page){
        String description= (String) request.getSession().getAttribute("email");
        System.out.println("-----"+description);
        List<LoginInfor> list=loginInforService.selectAll(description,limit,page);
        PageInfo<LoginInfor> pageInfo=new PageInfo<>(list);
        ResultJson success = ResultJson.success(pageInfo);
        Utils.returnJson(success,response);
    }




}
